-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: join srcset in source with ", " #7918
Fix: join srcset in source with ", " #7918
Conversation
https://html.spec.whatwg.org/multipage/images.html#srcset-attribute:
|
@@ -96,7 +96,7 @@ function collectSrcSetDependencies(asset, srcset, opts) { | |||
newSources.push(pair.join(' ')); | |||
} | |||
|
|||
return newSources.join(','); | |||
return newSources.join(', '); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be worth a comment explaining the significance of the trailing space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for late response, b19e0af 👍
↪️ Pull Request
Fixes: #7884
I found this is parcel’s issue. htmlnano depends on srcset, npm module to parse srcset attribute and after sindresorhus/srcset#11 PR was merged
srcset
module cannot parse srcset attribute without whitespace after “,” becausehoge.png,bar.png
is a valid URL.However, parsel joins multiple image URLs in srcset attribute with “,” so this issue happens. parcel should join multiple image URLs in srcset attribute with “, “(with space), so I fixed so.
💻 Examples
into transformed into above by HTMLTransformer
but
srcset
module cannot parse this srcset attribute as a two image URLs.🚨 Test instructions
I fixed html srcset integration testcase to check output HTML's srcset is valid.
✔️ PR Todo